<template lang="pug">
  el-amap-marker(
    class="amap-marker"
    v-for="(marker, index) in markers"
    :key="index"
    :vid="index"
    :title="marker.title"
    :position="marker.position"
    :icon="marker.icon"
    :events="marker.events"
    :visible="marker.visible"
    :draggable="marker.draggable")
</template>
<script>
/**坐标点 TODO
* @author 林墁霓 linmn@gddxit.com
* @desc  坐标点显示
*/
export default {
  name: 'amapMarker',
  props: {
    mapMarkers: {
      type: Array,
      default: () => []
    }, // 坐标点组
    title: {
      type: String,
      default: ''
    },
    icon: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      initMarker: {
        draggable: false,
        animation: 'AMAP_ANIMATION_BOUNCE',
        template: '<span>21221321</span>',
        events: {
          click: (a) => {
            const index = a.target.Qi.vid
            this.infoWindows.forEach(window => {
              window.visible = false
            })
            this.$nextTick(() => {
              this.infoWindows[index].visible = true
            })
          }
        }
      },
      infoWindows: [] // 信息窗体
    }
  },
  watch () {
  }
}
</script>